<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>医生列表</h2>
	</div>

    <div class="cf">
        <div class="fl">
            <select style="margin-right: 20px" id="export">
                <option value="">-导出-</option>
                <option value="FILTERED">导出筛选</option>
                <option value="CHECKED">导出勾选</option>
            </select>
            <button class="btn bg-light-blue ajax-post confirm" url="{:U('deleteDetail')}" target-form="ids">删 除</button>
        </div>

        <div class="cf">
            <div class="search-form" style="display: flex; align-items: center;">
                <input placeholder="姓名" name="name" class="text" value="{:I('name')}" style="margin-left: 20px">
                <input placeholder="手机号" name="phone" class="text" value="{:I('phone')}" style="margin-left: 20px">
                <input placeholder="医院" name="hospital" class="text" value="{:I('hospital')}" style="margin-left: 20px">
                <button style="margin-left: 20px" class="btn bg-orange" id="search" url="{:U('index')}">查询</button>
            </div>
        </div>

    </div>

    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
		<th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
		<th class="">编号</th>
		<th class="">姓名</th>
		<th class="">医院</th>
		<th class="">手机号</th>
		<th class="">上传病例数</th>
		<th class="">职称</th>
		<th class="">职务</th>
		<th class="">创建时间</th>
		<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
            <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
			<td>{$vo.id} </td>
			<td>{$vo.name}</td>
			<td>{$vo.hospital}</td>
			<td>{$vo.phone}</td>
			<td>{$vo.publish_count}</td>
			<td>{$vo.title}</td>
			<td>{$vo.duty}</td>
			<td><span>{$vo.createdate|time_format}</span></td>
			<td>
				<a class="op blue" href="{:U('Member/update&id='.$vo['id'])}" >编辑</a>
				<!--<a href="{:U('Member/deltet&id='.$vo['id'])}" class="confirm ajax-get op light-blue">删除</a>-->
		</tr>
		</volist>
		<else/>
		<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

	<script type="text/javascript">
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});

    $('#export').change(function () {
        var type = $(this).val();
        if (!type) return;
        $(this).val('');
        var ids = [];
        var query = '';
        if (type === 'CHECKED') {
            var ids = [];
            $('.ids:checked').each(function() {
                ids.push($(this).val())
            })
            if (!ids.length) {
                alert('没有勾选');
                return;
            }
        } else if (type === 'FILTERED') {
            query += $('.search-form').find('input,select').serialize();
        }

        window.open('{:U("export")}&type=' + type + '&ids=' + ids + '&' + query);
    });



    //导航高亮
    highlight_subnav('{:U('Member/index')}');
	</script>
</block>
